﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Service.Model.Map
{
    public class GameMap : EntityTypeConfiguration<Game>
    {
        public GameMap()
        {
            ToTable("dbo.Games");
            HasKey(g => g.GameId);

            Property(g => g.GameId).HasColumnName("CaseId").IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            HasMany(g => g.GamePlayers).WithRequired(p => p.Game).HasForeignKey(p => p.GameId);
        }
    }
}